# FILE: EntityFactory.py
# DESC: Base class for Entity object factories implementations.

from infra.exception import InvalidData

class EntityFactory:

	def __init__(self):
		self.errMsg_ = None


	def createEntity(self, argv, consumer = None, relevanceFactor = 1):
		if self.validate(argv):
			return self.doCreateEntity(consumer, relevanceFactor)
		else:
			if (self.errMsg_):
				raise InvalidData.InvalidData(self.errMsg_)


	def doCreateEntity(self, webDoc, relevanceFactor):
		"""Override to provide specific entity construction."""
		pass


	def getEntityType(self):
		"""Override to provide specitic entity type information."""
		pass
